]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
docs: Update miscellaneous in-code documentation for modules
authorEvan Welsh <contact@evanwelsh.com>
Thu, 8 Jun 2023 06:22:00 +0000 (23:22 -0700)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 5 Aug 2023 20:16:23 +0000 (22:16 +0200)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>

HACKING.md
src/st/st-scrollable.c

index 03e1134631e033ccbd21009127998fd0995b4898..e32b18c86ea4116e3b70fdffac04274ce8edf74c 100644 (file)
@@ -66,7 +66,7 @@ library. These headers are not installed, distributed or introspected.
 Use UpperCamelCase when importing modules to distinguish them from ordinary
 variables, e.g.
 ```javascript
-    const GLib = imports.gi.GLib;
+    import GLib from 'gi://GLib';
 ```
 Imports should be categorized into one of two places. The top-most import block
 should contain only "environment imports". These are either modules from
@@ -120,7 +120,7 @@ See [What's new in JavaScript 1.7](https://developer.mozilla.org/en/JavaScript/N
 There are many approaches to classes in JavaScript. We use standard ES6 classes
 whenever possible, that is when not inheriting from GObjects.
 ```javascript
-    var IconLabelMenuItem = class extends PopupMenu.PopupMenuBaseItem {
+    export class IconLabelMenuItem extends PopupMenu.PopupMenuBaseItem {
         constructor(icon, label) {
             super({ reactive: false });
             this.actor.add_child(icon);
@@ -136,7 +136,7 @@ whenever possible, that is when not inheriting from GObjects.
 For GObject inheritance, we use the GObject.registerClass() function provided
 by gjs.
 ```javascript
-    var MyActor = GObject.registerClass(
+    export const MyActor = GObject.registerClass(
     class MyActor extends Clutter.Actor {
         _init(params) {
             super._init(params);
@@ -152,7 +152,7 @@ GObject Introspection is a powerful feature that allows us to have native
 bindings for almost any library built around GObject. If a library requires
 you to inherit from a type to use it, you can do so:
 ```javascript
-    var MyClutterActor = GObject.registerClass(
+    export const MyClutterActor = GObject.registerClass(
     class MyClutterActor extends Clutter.Actor {
 
         vfunc_get_preferred_width(forHeight) {
@@ -203,7 +203,7 @@ wrapper class the "delegate".
 We sometimes use expando properties to set a property called `_delegate` on
 the actor itself:
 ```javascript
-    var MyActor = GObject.registerClass(
+    export const MyActor = GObject.registerClass(
     class MyActor extends Clutter.Actor {
         _init(params) {
             super._init(params);
@@ -214,7 +214,7 @@ the actor itself:
 
 Or using the deprecated `actor`:
 ```javascript
-    var MyClass = class {
+    export class MyClass {
         constructor() {
             this.actor = new St.Button({ text: "This is a button" });
             this.actor._delegate = this;
@@ -261,8 +261,8 @@ prototype:
 ```javascript
     const FnorbLib = imports.fborbLib;
 
-    var MyClass = class {
-        _init() {
+    export class MyClass {
+        constructor() {
             let fnorb = new FnorbLib.Fnorb();
             fnorb.connect('frobate', this._onFnorbFrobate.bind(this));
         }
index 3a77052dbc0d440143fe4742084c0a5051f40d31..a553c8b40691e0decf13fd154bad4409f74a8e1c 100644 (file)
@@ -97,7 +97,7 @@ st_scrollable_default_init (StScrollableInterface *g_iface)
        * JavaScript code may override this as demonstrated below:
        *
        * |[<!-- language="JavaScript" -->
-       * var MyScrollable = GObject.registerClass({
+       * export const MyScrollable = GObject.registerClass({
        *     Properties: {
        *         'hadjustment': GObject.ParamSpec.override(
        *             'hadjustment',